/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package nationsim.input;

import java.util.Hashtable;
import nationsim.components.nation.NationStateValues;

/**
 * Driver Class the reads the Bar and the UI panel input text fields and
 * writes them to the passed userInput object.
 * @author CJ
 */
public class UserInputReader {
    private UserInputReader(){}

    /*Okay this method is the only one that could be cut out but it here becuase
     * UserInput is a WRATPPER class that holds all the input if we choose to add
     * them.
     * */
    public static void readFromString(String[] input, UserInput userInput){
        userInput.userTextFields = new String[input.length];
        for(int i = 0; i < input.length; ++i)
            userInput.userTextFields[i] = input[i];
    }

    public static boolean checkLegalTextValues(UserInput input){
        //TODO error checking

        //Check

        return true;
    }

    public static void readFromBar(UserInputBarState state, UserInput userInput){
        userInput.barFields = new Hashtable();
        for(int i = 0; i < NationStateValues.USER_SET.length; ++i)
            userInput.barFields.put(i, state.storage.get(i));
    }
}
